var express = require('express');
const Mongoose = require('mongoose');
const { ObjectId } = Mongoose.Types;
var router = express.Router();
var commentModel = require('../tool/model/comment.js');
router.post('/', (req, res, next)=> {
  var obj = req.body;
  console.log(obj)
  var comment = new commentModel ({
    commentId:obj.userId,
    commmentArticleId:obj.articleID,
    commentContent:obj.content,
    commentAuthorName:obj.userName
  })
  comment.save(function(err,doc){
          if(err){
              console.log(err);
              return;
          }else{
            res.send({
              status: '0',
              type:'success',
              content: '评论成功！',
              data:doc
            })
          }
      })
});
module.exports = router;